/*
 * Node.h
 *
 *  Created on: 12-05-2013
 *      Author: Jarek
 */

#ifndef NODE_H_
#define NODE_H_

#include "GlobalData.h"
#include "Math/EMatrix4x4.h"
#include "EAnimation.h"
#include "EWorld.h"
#include "ETime.h"

//assimp includes
#include <scene.h>
#include <matrix4x4.h>

class World;

class Node {

private:
	char*					name;
	float					lastWorldMatrixTime;
	Matrix4x4<float>		lastWorldMatrix;


public:
	Matrix4x4<float>		currentWorldMatrix;
	Animation				*anim;
	Node*					parent;
	Node**					children;
	uint					childrenCount;

	Matrix4x4<float>		worldMatrix;

	enum NODE_TYPE
	{
		NODE_TYPE_UNKNOWN	= 0,
		NODE_TYPE_MODEL,
		NODE_TYPE_LIGHT,
		NODE_TYPE_CAMERA,



		NODE_TYPE_MAX
	} nodeType;


public:
	Node();
	virtual ~Node();

	virtual void		parseData		(const World& scene, const aiNode& ainode, const Node* parent = NULL);
	char*				getName			() const;
	void				setName			(const char* name);
	void				setWorldMatrix  (const aiMatrix4x4& aimatrix);
	Matrix4x4<float>    getWorldMatrix	() const;
	Matrix4x4<float> 	getWorldMatrix 	(const ETime& time);
	bool				parseAnimationData	(const aiNodeAnim& animation, const float ticksPerSecond);
};

#endif /* NODE_H_ */
